<template>
	<view style="position: relative;">
		<image class="img" src="./1001icon8.png" mode="widthFix"></image>
		<view class="backBtn" @tap="backBtn"></view>
		<view class="backBtn1" @tap="backBtn1"></view>
		<view class="backBtn2" @tap="backBtn2"></view>
		<view class="backBtn3" @tap="backBtn3"></view>
		<view class="list">{{list.balance.balanceStr}}</view>
		<view class="list1">{{kaNum}}</view>
		<view class="list2" style="color: #666666;"><span style="margin-left: 2vw;color: #222222;">{{list.balance.showBalance}}</span></view>
		<view class="detailed">
			<view class="years">{{month}}月/{{year}}</view>
			<view class="detailedMain">
				<view v-for="(item,index) in list.list" :key="index">
					<view class="month">
						<view>{{item.showDate.substr(8,2)}}</view>
						<view>{{item.week}}</view>
					</view>
					<view>
						<view v-for="(item1,index) in item.list" :key="index" class="detailedList" @tap="delBtn" :data-id="item1.id">
							<view>
								<view>{{item1.payTypeStr}}</view>
								<view style="font-size: 3.4vw;color: #666666;">{{item1.name}}</view>
							</view>
							<view>
								<view>余额 {{item1.amount2}}</view>
								<view>人民币元<span :class="item1.payType==0?'myred':'mygreen'">{{item1.payType==0?'':'-'}}{{item1.showAmount}}</span></view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	
</template>

<script>
	const http = require('../../../utils/http.js');
	export default {
		data() {
			return {
				list:null,
				kaNum:null
			}
		},
		onLoad(options) {
			this.id=options.id
		},
		onShow() {
			var now = new Date();
			this.year = now.getFullYear(); //年
			if((now.getMonth() + 1) < 10){ //月
				this.month = '0'+(now.getMonth() + 1)
			}else{
				this.month = now.getMonth() + 1;
			}
			http.get('/api/balance/getBalanceDetail',{balanceId:this.id}).then(res => {
				//console.log(res.result.balance.bankCode)
				//console.log(res.result.balance.bankCode.replace(/^(\w{4})\w{10}(.*)$/, '$1***$2'))
				if (res.code == 200 && res.result) {
					this.list=res.result
					this.kaNum=res.result.balance.bankCode.replace(/^(\w{4})\w{11}(.*)$/, '$1 ****** $2')
				}
			})
		},
		methods: {
			backBtn:function(){
				uni.navigateBack({
					delta: 1
				})
			},
			backBtn1:function(){
				uni.navigateTo({
				    url: '1001-5?id='+this.id
				});
			}
		}
	}
</script>

<style>
	page{
		color: #333333;
		font-family: 'jtfont-icon';
	}
	@font-face {
		font-family:jtfont-icon;
		src: url('~@/fonts/zhfont.ttf');
	}
	.myred{
		color: #ff6766;
	}
	.mygreen{
		color: #00c192;
	}
	.backBtn{
		width: 10vw;
		height: 10vw;
		position: absolute;
		top: 9vw;
		left: 4vw;
	}
	.backBtn1{
		width: 15vw;
		height: 15vw;
		position: absolute;
		top: 84vw;
		right: 23vw;
	}
	.img{
		width: 100%;
	}
	.list{
		position: absolute;
		top: 40vw;
		right: 7vw;
		font-size: 3.5vw;
	}
	.list1{
		position: absolute;
		top: 27.2vw;
		left: 24vw;
		font-size: 3.6vw;
	}
	.list2{
		position: absolute;
		top: 52.2vw;
		right: 7vw;
		font-size: 3.6vw;
	}
	.detailed{
		display: flex;
		flex-direction: column;
		margin-top: -2vw;
	}
	.detailed .years{
		width: 100%;
		padding: 2vw 3vw;
		background: #f8f8f8;
		color: #8d9aa0;
		font-size: 3.4vw;
		border-bottom: 1px solid #F2F2F2;
		border-top: 1px solid #F2F2F2;
	}
	.detailedMain{
	}
	.detailedMain>view{
		display: flex;
		flex-direction: row;
	}
	.detailedMain .month{
		display: flex;
		flex-direction: column;
		align-items: center;
		padding: 3.5% 3vw;
		background: #f1f5f4;
		color: #8d9aa0;
	}
	.detailedMain>view>view:nth-child(2){
		flex: 1;
	}
	.detailedMain .month>view:nth-child(1){
		font-size: 4.4vw;
		font-weight: bold;
	}
	.detailedMain .month>view:nth-child(2){
		font-size: 3vw;
	}
	.detailedList{
		background: #FFFFFF;
		padding: 3vw;
		border-bottom: 1px solid #F2F2F2;
	}
	.detailedList>view:nth-child(1){
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		font-size: 3.8vw;
		color: #333333;
		margin-bottom: 1.2vw;
	}
	.detailedList>view:nth-child(2){
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		font-size: 3.4vw;
		color: #666666;
	}
	.detailedList>view:nth-child(2)>view:nth-child(2){
		color: #333333;
	}
	.detailedList>view:nth-child(2)>view:nth-child(2) span{
		margin-left: 0.8vw;
	}
</style>
